//
//  OpenGLESBaseViewController.m
//  TestPrj
//
//  Created by 朱铅峰 on 2021/3/25.
//  Copyright © 2021 Xing. All rights reserved.
//

#import "OpenGLESBaseViewController.h"
#import "OpenGL_GLSLViewController.h"
#import "OpenGL_GLKitViewController.h"

@interface OpenGLESBaseViewController ()

proStrong NSArray<NSString *> *dataSource;

@end

@implementation OpenGLESBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.dataSource = @[@"GKKit渲染",@"GLSL渲染"];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
}

#pragma mark - tableView delegate

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.text = self.dataSource[indexPath.row];
    return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.dataSource.count;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    switch (indexPath.row) {
        case 0:
        {
            OpenGL_GLSLViewController *vc = [OpenGL_GLSLViewController new];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        case 1:
        {
            OpenGL_GLKitViewController *vc = [OpenGL_GLKitViewController new];
            [self.navigationController pushViewController:vc animated:YES];
            break;
        }
        default:
            break;
    }
}

@end
